When doing a set of post-hoc tests in any software, the output will be formatted as a table,
with each comparison listed on its own row, and information about the comparison listed in the
columns.
In a real scenario, after completing your post-hoc test, you would stop here and interpret your findings.
But because we want to explain the Scheffe test, we can take an opportunity compare what we find
when we run that one, too. Let’s start by loading the DescTools package using the R code
library(DescTools) (Chapter 4 explains how to use packages in R). Next, let’s try the Scheffe test by
using the following code on our existing ANOVA object: ScheffeTest(GLUCOSE_aov).
The Scheffe test output is arranged in a similar matrix, but also includes R’s significance codes. This
time, according to R’s coding system, M and NM are statistically significantly different at p < 0.001,
and M and OTH are statistically significantly different at p < 0.01. Although the actual numbers are
slightly different, the interpretation is the same as what you saw using the Tukey-Kramer test.
Sometimes you may not know which post-hoc test to select for your ANOVA. If you have an
advisor or you are on a research team, you should discuss which one is best. However, if you run
the one you select and do not trust the results, it’s not a bad idea to run the other ones and keep
track of the results. The p values will always come out different, but if the interpretation changes
— meaning different comparisons are statistically significant, depending upon what test you
choose — you may want to rethink doing post-hoc tests. This means that the results you are getting
are unstable.
Running nonparametric tests
As a reminder, the Wilcoxon Sum-of-Ranks test is the nonparametric alternative to the t test, which you
can use if your data do not follow a normal distribution. Like with the t test, you can run a Wilcoxon
Sum-of-Ranks test in R with options that gives you results if you are doing a paired t test. But to simply
repeat the independent t test we did earlier comparing mean fasting glucose in married NHANES
participants compared to all other marital statuses, you would run this code:
wilcox.test(NHANES$LBXGLU ~ NHANES$MARRIED).
The Kruskal-Wallis test is a nonparametric ANOVA alternative. Like the ANOVA, you can use the
Kruskal-Wallis to test whether the mean fasting glucose is equal in the three-level marital status
variable MARITAL. The R code for the Kruskal-Wallis test is different from the ANOVA code because
it does not require you to produce an object for the summary statistics. The following code prints the
results to the output: kruskal.test(LBXGLU ~ MARITAL, data = NHANES).
Nonparametric tests don’t compare group means or test for a nonzero mean difference. Rather, they
compare group medians, or they deal with ranking the order of variables and analyze those ranks.
Because it this, the output from R and other programs will likely focus on reporting the p value of the
test.